package com.xhwl.centiotdata.handler.alarm;

import org.springframework.util.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author Leon
 * @Description: TODO
 * @Date: 2022/3/22 15:45
 */
public class AlarmFactory {

    private static Map<Object, AlarmHandler> handlerMap = new HashMap<>(16);

    public static AlarmHandler getInvokeStrategy(Object mark) {
        return handlerMap.get(mark);
    }

    public static void register(Object mark, AlarmHandler handler) {
        if (StringUtils.isEmpty(mark)) {
            return;
        }
        handlerMap.putIfAbsent(mark, handler);
    }
}
